using XLua;
using System;
namespace SgsUI
{
    public class LuaHelper
    {
        public static LuaHelper instance;

        public static LuaHelper Instance
        {
            get
            {
                if(instance == null)
                {
                    instance = new LuaHelper();
                }

                return instance;
            }
        }

        private LuaTable m_lang;

        public LuaHelper()
        {
            
        }

        public void SetLang(LuaTable luatable)
        {
            m_lang = luatable;
        }

        public string GetTransTextKey(string text)
        {
            if(m_lang == null)
            {
                return text;
            }

            string outText;
            m_lang.Get(text,out outText);
            if(outText != null && outText != String.Empty)
            {
                return outText;
            }
            else
            {
                return text;
            }
        }
    }
}